local postKey = KEYS[1];
local recentPostsListKey = KEYS[2];
local postClicksZSetKey = KEYS[3];
local post = ARGV[1];

local recentPostsMaxSize = 30;
local scoreDelta = 1;

local size = redis.call('LLEN', recentPostsListKey);
if size >= recentPostsMaxSize then
	redis.call('LTRIM', recentPostsListKey, 0, (recentPostsMaxSize - 1))
end

redis.call('LPUSH', recentPostsListKey, post);

redis.call('ZINCRBY', postClicksZSetKey, scoreDelta, postKey);

return true;